namespace Clarius.PresentationModel.Design.Tests
{
    using System;
    using System.ComponentModel;
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("ViewModel Tool", "3.0.0.0")]
    public partial class My<T> : ISupportInitialize, ISupportInitializeNotification, IChangeTracking, INotifyPropertyChanged, INotifyPropertyChanging
    {
        
        const string InitializationNotBegun = "Initialization has not been started.";
        
        const string NotInitialized = "The object has not been initialized properly. Call Initialize prior to use.";
        
        private bool _initializing;
        
        private bool _isInitialized;
        
        private bool _isChanged;
        
        protected virtual bool IsInitializing
        {
            get
            {
                return this._initializing;
            }
        }
        
        private bool RequiresInitialize
        {
            get
            {
                bool result = (this.IsInitialized == false);
                result = (result || this.IsChanged);
                return result;
            }
        }
        
        public bool IsInitialized
        {
            get
            {
                return (this._isInitialized && this.AreNestedInitialized);
            }
        }
        
        ///  <summary>Gets whether the object properties that support <see cref='ISupportInitializeNotification'/> are initialized.</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected virtual bool AreNestedInitialized
        {
            get
            {
                return true;
            }
        }
        
        public bool IsChanged
        {
            get
            {
                return this._isChanged;
            }
        }
        
        /// <summary>Signals that the object has been initialized.</summary>
        public event EventHandler Initialized;
        
        /// <summary>Signals that a property has changed.</summary>
        public event PropertyChangedEventHandler PropertyChanged;
        
        /// <summary>Signals that a property is changing.</summary>
        public event PropertyChangingEventHandler PropertyChanging;
        
        /// <summary>Signals that the property <see cref='Value'/> is changing.</summary>
        public event EventHandler ValueChanging;
        
        /// <summary>Signals that the property <see cref='Value'/> has changed.</summary>
        public event EventHandler ValueChanged;
        
        /// <summary>Initializes the object for use.</summary>
        public void Initialize()
        {
            if (this.RequiresInitialize)
            {
                this.BeginInit();
                this.InitializeNested();
                this.EndInit();
            }
            this.AcceptChanges();
        }
        
        /// <summary>Initializes the properties whose values support <see cref='ISupportInitialize'/>.</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected virtual void InitializeNested()
        {
        }
        
        public void BeginInit()
        {
            this._initializing = true;
        }
        
        public void EndInit()
        {
            if ((this._initializing == false))
            {
                throw new InvalidOperationException(My<T>.InitializationNotBegun);
            }
            this.DoInitialize();
            this._initializing = false;
            this._isInitialized = true;
            if ((this.Initialized != null))
            {
                this.Initialized(this, EventArgs.Empty);
            }
        }
        
        /// <summary>Determines whether the value is null or its 
        ///				<see cref='ISupportInitializeNotification.IsInitialized'/> is <see langword='true' />.
        ///				</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected bool IsValueInitialized(ISupportInitializeNotification child)
        {
            return ((child == null) 
                        || child.IsInitialized);
        }
        
        public void AcceptChanges()
        {
            this._isChanged = false;
        }
        
        /// <summary>Raises the <see cref='PropertyChanged'/> event.</summary>
        ///					  <param name='property'>Name of the property that changed.</param>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected void RaisePropertyChanged(string property)
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
            if ((this._isChanged == false))
            {
                this._isChanged = true;
                this.RaisePropertyChanged("IsChanged");
            }
        }
        
        /// <summary>Raises the <see cref='PropertyChanging'/> event.</summary>
        ///					  <param name='property'>Name of the property that is changing.</param>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected void RaisePropertyChanging(string property)
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, new PropertyChangingEventArgs(property));
            }
        }
        
        /// <summary>Raises the <see cref='ValueChanging'/> event.</summary>
        private void RaiseValueChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.ValueChanging != null))
            {
                this.ValueChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("Value");
        }
        
        /// <summary>Raises the <see cref='ValueChanged'/> event.</summary>
        private void RaiseValueChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.ValueChanged != null))
            {
                this.ValueChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("Value");
        }
    }
}
namespace Clarius.PresentationModel.Design.Tests
{
    using System;
    using System.ComponentModel;
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("ViewModel Tool", "3.0.0.0")]
    public partial class ChildNotifier : INotifyPropertyChanged, INotifyPropertyChanging
    {
        
        /// <summary>Signals that a property has changed.</summary>
        public event PropertyChangedEventHandler PropertyChanged;
        
        /// <summary>Signals that a property is changing.</summary>
        public event PropertyChangingEventHandler PropertyChanging;
        
        /// <summary>Signals that the property <see cref='Value'/> is changing.</summary>
        public event EventHandler ValueChanging;
        
        /// <summary>Signals that the property <see cref='Value'/> has changed.</summary>
        public event EventHandler ValueChanged;
        
        /// <summary>Raises the <see cref='PropertyChanged'/> event.</summary>
        ///					  <param name='property'>Name of the property that changed.</param>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected void RaisePropertyChanged(string property)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
        
        /// <summary>Raises the <see cref='PropertyChanging'/> event.</summary>
        ///					  <param name='property'>Name of the property that is changing.</param>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected void RaisePropertyChanging(string property)
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, new PropertyChangingEventArgs(property));
            }
        }
        
        /// <summary>Raises the <see cref='ValueChanging'/> event.</summary>
        private void RaiseValueChanging()
        {
            if ((this.ValueChanging != null))
            {
                this.ValueChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("Value");
        }
        
        /// <summary>Raises the <see cref='ValueChanged'/> event.</summary>
        private void RaiseValueChanged()
        {
            if ((this.ValueChanged != null))
            {
                this.ValueChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("Value");
        }
    }
}
namespace Clarius.PresentationModel.Design.Tests
{
    using System;
    using System.ComponentModel;
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("ViewModel Tool", "3.0.0.0")]
    public partial class MockBase : ISupportInitialize, ISupportInitializeNotification, IChangeTracking, INotifyPropertyChanged, INotifyPropertyChanging
    {
        
        const string InitializationNotBegun = "Initialization has not been started.";
        
        const string NotInitialized = "The object has not been initialized properly. Call Initialize prior to use.";
        
        private bool _initializing;
        
        private bool _isInitialized;
        
        private bool _isChanged;
        
        protected virtual bool IsInitializing
        {
            get
            {
                return this._initializing;
            }
        }
        
        private bool RequiresInitialize
        {
            get
            {
                bool result = (this.IsInitialized == false);
                result = (result || this.IsChanged);
                return result;
            }
        }
        
        public bool IsInitialized
        {
            get
            {
                return (this._isInitialized && this.AreNestedInitialized);
            }
        }
        
        ///  <summary>Gets whether the object properties that support <see cref='ISupportInitializeNotification'/> are initialized.</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected virtual bool AreNestedInitialized
        {
            get
            {
                return (true && this.IsValueInitialized(BaseObject as ISupportInitializeNotification));
            }
        }
        
        public bool IsChanged
        {
            get
            {
                return this._isChanged;
            }
        }
        
        /// <summary>Signals that the object has been initialized.</summary>
        public event EventHandler Initialized;
        
        /// <summary>Signals that a property has changed.</summary>
        public event PropertyChangedEventHandler PropertyChanged;
        
        /// <summary>Signals that a property is changing.</summary>
        public event PropertyChangingEventHandler PropertyChanging;
        
        /// <summary>Signals that the property <see cref='BaseIntValue'/> is changing.</summary>
        public event EventHandler BaseIntValueChanging;
        
        /// <summary>Signals that the property <see cref='BaseIntValue'/> has changed.</summary>
        public event EventHandler BaseIntValueChanged;
        
        /// <summary>Signals that the property <see cref='Auto'/> is changing.</summary>
        public event EventHandler AutoChanging;
        
        /// <summary>Signals that the property <see cref='Auto'/> has changed.</summary>
        public event EventHandler AutoChanged;
        
        /// <summary>Signals that the property <see cref='BaseObject'/> is changing.</summary>
        public event EventHandler BaseObjectChanging;
        
        /// <summary>Signals that the property <see cref='BaseObject'/> has changed.</summary>
        public event EventHandler BaseObjectChanged;
        
        /// <summary>Signals that the property <see cref='CalculatedProperty'/> is changing.</summary>
        public event EventHandler CalculatedPropertyChanging;
        
        /// <summary>Signals that the property <see cref='CalculatedProperty'/> has changed.</summary>
        public event EventHandler CalculatedPropertyChanged;
        
        /// <summary>Initializes the object for use.</summary>
        public void Initialize()
        {
            if (this.RequiresInitialize)
            {
                this.BeginInit();
                this.InitializeNested();
                this.EndInit();
            }
            this.AcceptChanges();
        }
        
        /// <summary>Initializes the properties whose values support <see cref='ISupportInitialize'/>.</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected virtual void InitializeNested()
        {
            ISupportInitialize initializable;
            initializable = BaseObject as ISupportInitialize;
            if ((initializable != null))
            {
                initializable.BeginInit();
                initializable.EndInit();
            }
        }
        
        public void BeginInit()
        {
            this._initializing = true;
        }
        
        public void EndInit()
        {
            if ((this._initializing == false))
            {
                throw new InvalidOperationException(MockBase.InitializationNotBegun);
            }
            this.DoInitialize();
            this._initializing = false;
            this._isInitialized = true;
            if ((this.Initialized != null))
            {
                this.Initialized(this, EventArgs.Empty);
            }
        }
        
        /// <summary>Determines whether the value is null or its 
        ///				<see cref='ISupportInitializeNotification.IsInitialized'/> is <see langword='true' />.
        ///				</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected bool IsValueInitialized(ISupportInitializeNotification child)
        {
            return ((child == null) 
                        || child.IsInitialized);
        }
        
        public void AcceptChanges()
        {
            this._isChanged = false;
            IChangeTracking tracked;
            tracked = BaseObject as IChangeTracking;
            if ((tracked != null))
            {
                tracked.AcceptChanges();
            }
        }
        
        /// <summary>Raises the <see cref='PropertyChanged'/> event.</summary>
        ///					  <param name='property'>Name of the property that changed.</param>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected void RaisePropertyChanged(string property)
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
            if ((this._isChanged == false))
            {
                this._isChanged = true;
                this.RaisePropertyChanged("IsChanged");
            }
        }
        
        /// <summary>Raises the <see cref='PropertyChanging'/> event.</summary>
        ///					  <param name='property'>Name of the property that is changing.</param>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected void RaisePropertyChanging(string property)
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, new PropertyChangingEventArgs(property));
            }
        }
        
        /// <summary>Raises the <see cref='BaseIntValueChanging'/> event.</summary>
        private void RaiseBaseIntValueChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.BaseIntValueChanging != null))
            {
                this.BaseIntValueChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("BaseIntValue");
        }
        
        /// <summary>Raises the <see cref='BaseIntValueChanged'/> event.</summary>
        private void RaiseBaseIntValueChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.BaseIntValueChanged != null))
            {
                this.BaseIntValueChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("BaseIntValue");
        }
        
        /// <summary>Raises the <see cref='AutoChanging'/> event.</summary>
        private void RaiseAutoChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.AutoChanging != null))
            {
                this.AutoChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("Auto");
        }
        
        /// <summary>Raises the <see cref='AutoChanged'/> event.</summary>
        private void RaiseAutoChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.AutoChanged != null))
            {
                this.AutoChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("Auto");
        }
        
        /// <summary>Raises the <see cref='BaseObjectChanging'/> event.</summary>
        private void RaiseBaseObjectChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.BaseObjectChanging != null))
            {
                this.BaseObjectChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("BaseObject");
            INotifyPropertyChanged inotify = BaseObject as INotifyPropertyChanged;
            if ((inotify != null))
            {
                inotify.PropertyChanged -= new PropertyChangedEventHandler(this.HandleBaseObjectChanged);
            }
        }
        
        /// <summary>Raises the <see cref='BaseObjectChanged'/> event.</summary>
        private void RaiseBaseObjectChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.BaseObjectChanged != null))
            {
                this.BaseObjectChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("BaseObject");
            INotifyPropertyChanged inotify = BaseObject as INotifyPropertyChanged;
            if ((inotify != null))
            {
                inotify.PropertyChanged += new PropertyChangedEventHandler(this.HandleBaseObjectChanged);
            }
        }
        
        private void HandleBaseObjectChanged(object sender, PropertyChangedEventArgs args)
        {
            if ((this.BaseObjectChanged != null))
            {
                this.BaseObjectChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("BaseObject");
        }
        
        /// <summary>Raises the <see cref='CalculatedPropertyChanging'/> event.</summary>
        private void RaiseCalculatedPropertyChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.CalculatedPropertyChanging != null))
            {
                this.CalculatedPropertyChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("CalculatedProperty");
        }
        
        /// <summary>Raises the <see cref='CalculatedPropertyChanged'/> event.</summary>
        private void RaiseCalculatedPropertyChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.CalculatedPropertyChanged != null))
            {
                this.CalculatedPropertyChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("CalculatedProperty");
        }
    }
}
namespace Clarius.PresentationModel.Design.Tests
{
    using System;
    using System.ComponentModel;
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("ViewModel Tool", "3.0.0.0")]
    public partial class MockDerived
    {
        
        ///  <summary>Gets whether the object properties that support <see cref='ISupportInitializeNotification'/> are initialized.</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected override bool AreNestedInitialized
        {
            get
            {
                return ((base.AreNestedInitialized && this.IsValueInitialized(DerivedObject as ISupportInitializeNotification)) 
                            && this.IsValueInitialized(((ISupportInitializeNotification)(this.Mock))));
            }
        }
        
        /// <summary>Signals that the property <see cref='DerivedIntValue'/> is changing.</summary>
        public event EventHandler DerivedIntValueChanging;
        
        /// <summary>Signals that the property <see cref='DerivedIntValue'/> has changed.</summary>
        public event EventHandler DerivedIntValueChanged;
        
        /// <summary>Signals that the property <see cref='DerivedObject'/> is changing.</summary>
        public event EventHandler DerivedObjectChanging;
        
        /// <summary>Signals that the property <see cref='DerivedObject'/> has changed.</summary>
        public event EventHandler DerivedObjectChanged;
        
        /// <summary>Signals that the property <see cref='Mock'/> is changing.</summary>
        public event EventHandler MockChanging;
        
        /// <summary>Signals that the property <see cref='Mock'/> has changed.</summary>
        public event EventHandler MockChanged;
        
        /// <summary>Initializes the nested properties that support <see cref='ISupportInitialize'/>.</summary>
        [EditorBrowsableAttribute(EditorBrowsableState.Never)]
        protected override void InitializeNested()
        {
            base.InitializeNested();
            ISupportInitialize initializable;
            initializable = DerivedObject as ISupportInitialize;
            if ((initializable != null))
            {
                initializable.BeginInit();
                initializable.EndInit();
            }
            initializable = ((ISupportInitialize)(this.Mock));
            if ((initializable != null))
            {
                initializable.BeginInit();
                initializable.EndInit();
            }
        }
        
        /// <summary>Raises the <see cref='DerivedIntValueChanging'/> event.</summary>
        private void RaiseDerivedIntValueChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.DerivedIntValueChanging != null))
            {
                this.DerivedIntValueChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("DerivedIntValue");
        }
        
        /// <summary>Raises the <see cref='DerivedIntValueChanged'/> event.</summary>
        private void RaiseDerivedIntValueChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.DerivedIntValueChanged != null))
            {
                this.DerivedIntValueChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("DerivedIntValue");
        }
        
        /// <summary>Raises the <see cref='DerivedObjectChanging'/> event.</summary>
        private void RaiseDerivedObjectChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.DerivedObjectChanging != null))
            {
                this.DerivedObjectChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("DerivedObject");
            INotifyPropertyChanged inotify = DerivedObject as INotifyPropertyChanged;
            if ((inotify != null))
            {
                inotify.PropertyChanged -= new PropertyChangedEventHandler(this.HandleDerivedObjectChanged);
            }
        }
        
        /// <summary>Raises the <see cref='DerivedObjectChanged'/> event.</summary>
        private void RaiseDerivedObjectChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.DerivedObjectChanged != null))
            {
                this.DerivedObjectChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("DerivedObject");
            INotifyPropertyChanged inotify = DerivedObject as INotifyPropertyChanged;
            if ((inotify != null))
            {
                inotify.PropertyChanged += new PropertyChangedEventHandler(this.HandleDerivedObjectChanged);
            }
        }
        
        private void HandleDerivedObjectChanged(object sender, PropertyChangedEventArgs args)
        {
            if ((this.DerivedObjectChanged != null))
            {
                this.DerivedObjectChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("DerivedObject");
        }
        
        /// <summary>Raises the <see cref='MockChanging'/> event.</summary>
        private void RaiseMockChanging()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.MockChanging != null))
            {
                this.MockChanging(this, EventArgs.Empty);
            }
            this.RaisePropertyChanging("Mock");
            INotifyPropertyChanged inotify = ((INotifyPropertyChanged)(this.Mock));
            if ((inotify != null))
            {
                inotify.PropertyChanged -= new PropertyChangedEventHandler(this.HandleMockChanged);
            }
        }
        
        /// <summary>Raises the <see cref='MockChanged'/> event.</summary>
        private void RaiseMockChanged()
        {
            if ((this.IsInitializing == true))
            {
                return;
            }
            if ((this.MockChanged != null))
            {
                this.MockChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("Mock");
            INotifyPropertyChanged inotify = ((INotifyPropertyChanged)(this.Mock));
            if ((inotify != null))
            {
                inotify.PropertyChanged += new PropertyChangedEventHandler(this.HandleMockChanged);
            }
        }
        
        private void HandleMockChanged(object sender, PropertyChangedEventArgs args)
        {
            if ((this.MockChanged != null))
            {
                this.MockChanged(this, EventArgs.Empty);
            }
            this.RaisePropertyChanged("Mock");
        }
    }
}
